<template>
  <section class="hero">
    <el-carousel  class="carousel">
      <el-carousel-item v-for="item in slideshowList" :key="item.id" style="height: 600px;" @click="clickSlideshow(item.httpUrl)">
        <img style="width: 100%; height:100%;" :src="item.imageUrl" alt="">
      </el-carousel-item>
    </el-carousel>
  </section>
</template>

<script setup lang="ts">
  import { onMounted, ref } from "vue";
  import { getSlideshowList } from "@/api/nexusSphere/slideshow.js";
    interface SlideshowItem {
    id: number;
    imageUrl: string;
    httpUrl: string;
  }

  const slideshowList = ref<SlideshowItem[]>([]);
  const getList = async () => {
    const res = await getSlideshowList();
    slideshowList.value = res.data.data;
  }

  const clickSlideshow = (url:string) => {
    window.open(url);
  }

  onMounted(() => {
      getList();
  })
</script>

<style scoped lang="scss">
.hero {
  position: relative;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;

  .carousel {
    height: 600px;
    width: 1100px;
  }
}
</style>
